package cn.lf.android.lawfirm.inputsource.view;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import cn.lf.android.lawfirm.R;
import cn.lf.android.lawfirm.inputsource.model.People;
import cn.lf.android.lawfirm.utils.DebugLog;

/**
 * 安源人适配器
 */
public  class SourcePeopleAdapter extends BaseAdapter {

	Context context;
	List<People> list;
	private LayoutInflater inflater;
	public SourcePeopleAdapter(Context context, List<People> list) {
		super();
		this.context = context;
		this.list = list;
		this.inflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder;
		if (null == convertView) {
			viewHolder = new ViewHolder();
			convertView = inflater.inflate(R.layout.item_quasicommissionedparty,null);
			viewHolder.name = (TextView) convertView.findViewById(R.id.name);
			convertView.setTag(viewHolder);
			
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		DebugLog.e("------"+list.get(position).name);
		viewHolder.name.setText(list.get(position).userName);
		return convertView;
	}

	class ViewHolder {
		TextView name;
	}
}
